package org.zlb.algorithm.sort;

/**
 * 冒泡排序
 *
 * @author zhoulingbo
 * @date 2021/7/7 16:54
 */
public class BubbleSort extends AbstractSort {

    public void sort(int[] arr) {
        for (int i=0; i<arr.length-1; i++) {
            for (int j=0; j<arr.length-1-i; j++) {
                if (compare(arr[j], arr[j+1]) > 0) {
                    swap(arr, j, j+1);
                }
            }
        }
    }

}
